package com.kk.springmvc.demo.common.enums;

/**
* ResultCodeEnum.java
* 类说明 TODO
*
* @author chengkai
* @date  2017年6月9日 下午3:35:46
*/
public enum ResultCodeEnum {

    SUCCESS("0", "成功"),

    FAIL("-1", "失败"),

    ERROR("-2", "系统异常");

    private String code;
    private String message;

    ResultCodeEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public String getMessage(String code) {
        for (ResultCodeEnum e : ResultCodeEnum.values()) {
            if (e.code.equals(code)) {
                return e.message;
            }
        }
        return "";
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

}
